﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.components.secretary {
    import flash.display.*;
    import __AS3__.vec.*;
    import net.wooga.pets.utils.timeline.*;
    import net.wooga.pets.views.components.secretary.states.*;

    public class ReceptionSecretaryViewStateManager implements IReceptionSecretaryState {

        private var _sequenceBasedStatesTimeline:SequenceBasedStatesTimeline;
        private var _statesLookupTable:Vector.<IReceptionSecretaryState>;
        private var _currentState:IReceptionSecretaryState;

        public static const INIT_STATE:uint = 0;
        public static const LISTENING_STATE:uint = 1;
        public static const IDLE_STATE:uint = 2;

        public function initialize(_arg1:MovieClip):void{
            this._sequenceBasedStatesTimeline = new SequenceBasedStatesTimeline(_arg1);
            this._statesLookupTable = new Vector.<IReceptionSecretaryState>();
            this._statesLookupTable[INIT_STATE] = new ReceptionSecretaryInitState(this, this._sequenceBasedStatesTimeline);
            this._statesLookupTable[LISTENING_STATE] = new ReceptionSecretaryListenState(this, this._sequenceBasedStatesTimeline);
            this._statesLookupTable[IDLE_STATE] = new ReceptionSecretaryIdleState(this, this._sequenceBasedStatesTimeline);
            this._currentState = this.getStateByLookupKey(INIT_STATE);
            this._currentState.initiate();
        }
        public function destroy():void{
            this.stop();
            this._statesLookupTable = null;
            this._sequenceBasedStatesTimeline.destroy();
        }
        public function stop():void{
            this._currentState.stop();
        }
        public function initiate():void{
            this._currentState.initiate();
        }
        public function doIdle():void{
            this._currentState.doIdle();
        }
        public function doListening():void{
            this._currentState.doListening();
        }
        public function set currentState(_arg1:IReceptionSecretaryState):void{
            this.stop();
            this._currentState = _arg1;
            this.initiate();
        }
        public function getStateByLookupKey(_arg1:int):IReceptionSecretaryState{
            return ((this._statesLookupTable[_arg1] as IReceptionSecretaryState));
        }

    }
}//package net.wooga.pets.views.components.secretary 
